home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1995 April / Internet Tools.iso / x25 / nrs.shar.Z / nrs.shar / make.cpl < prev    next >
Encoding:
Text File  |  1990-04-27  |  11.5 KB  |  372 lines

  1. /* RCSid[]="@(#)$Header: make.cpl,v 3.4 87/10/13 18:21:48 pb Exp $" */
  2. /*                                                                  */
  3. /*  procedure to build the Cambridge nrs database processor         */
  4. /*                                                                  */
  5. /*  option list:                                                    */
  6. /*                                                                  */
  7. /*  operations: (default is to make everything that it needs to)    */
  8. /*      compile:  Force compilation of the sources                  */
  9. /*      link:     Force link of the binaries                        */
  10. /*      install:  Install the executable in the target dir          */
  11. /*      build:    == -compile -link -install -report                */
  12. /*      getfiles: Fetch the DERFIL2 from salford                    */
  13. /*      convert:  Convert DERFIL2 into a usable format              */
  14. /*      generate: Generate the T.CENTRAL file                       */
  15. /*                                                                  */
  16. /*  general flags:                                                  */
  17. /*      report: If set reports on the progress of the make          */
  18. /*                                                                  */
  19. /*  specific flags:                                                 */
  20. /*      debug:  If set builds a version which interfaces with the   */
  21. /*              source level debugger                    */
  22. /*    debugcpl: enables CPL debugging                    */
  23. /*      nocomo: If set does not record the progress of the build    */
  24. /*              in a command output file                            */
  25. /*                                                                  */
  26. /*  All remaining arguments are taken as compiler options.          */
  27. /*                                                                  */
  28.  
  29. &args unclaimed:uncl; compile:-compile,-c comfile:entry; link:-link,-l; ~
  30.       install:-install,-i; getfiles:-get,-gf; convert:-convert,-cv; ~
  31.       generate:-generate,-g; debug:-debug,-d; report:-report,-rpt; ~
  32.       nocomo:-no_como,-nco; build:-build,-bld,-b; debugcpl:-debugcpl;
  33.  
  34. &if ^ [null %debugcpl%] &then~
  35.    &debug &echo all &watch
  36.  
  37. &s name      := NRSGEN       /* name of executable                      */
  38. &s decompress := DECOMPRESS  /* and the FULL NAME of decompress program */
  39. &s version   := NRS3.3       /* version number of executable            */
  40. &s nift      := TRUE         /* define if NIFT is available             */
  41. &s serc      := TRUE         /* define if SERC FTP is available         */
  42. &s isocept   := FALSE        /* define if ISOCEPT is available          */
  43. &s localuser := NSUM52       /* used by serc and isocept to get DERFIL2 */
  44. &s localpw   := PLEB         /* used by serc and nift to get DERFIL2    */
  45. &s nrsuser   := NRSUSERS     /* used to get DERFIL2                     */
  46. &s nrspw     := NRS          /* used to get DERFIL2                     */
  47. &s thissite  := UMPA         /* used by isocept to get DERFIL2          */
  48.  
  49. /* base file names */
  50.  
  51. &s base    := *>                /* the development directory        */
  52. &s instdir := NAMESERVER*>TOOLS>/* installation directory           */
  53. &s ddir    := NAMESERVER*>NRS>  /* database directory               */
  54.  
  55. /* these should be standard */
  56.  
  57. &s source    := %base%           /* source directory                 */
  58. &s include   := %base%           /* insert file directory            */
  59. &s bin       := %base%           /* object directory                 */
  60. &s cfs       := %base%           /* cf source directory              */
  61. &s central   := %base%T.CENTRAL  /* location of output file          */
  62. &s config    := %ddir%CENTRAL.CF /* location of config file          */
  63. &s derfil    := %ddir%DERFIL2    /* the DERFIL2                      */
  64. &s rawderfil := %derfil%.RAW     /* the raw (compressed) DERFIL2     */
  65. &s nrsaddr   := NRS              /* used to get DERFIL2              */
  66. &s nrsdir    := MAKE.NRS>DATABASE> /* used to get DERFIL2            */
  67.  
  68. /* shouldn't need to be tailored */
  69.  
  70. &s cflags := -sof -include %include% %debug% -define VERSION "%version%" ~
  71.               %unclaimed% /* compiler flags */
  72. &s defmodules := defs main config lru misc output /* modules to compile */
  73.  
  74. /* set up subnetwork context pairs */
  75.  
  76. &s network := X29.JANET ~
  77.               X29.PSS ~
  78.               TS29.JANET ~
  79.               TS29.PSS ~
  80.               FTP.JANET ~
  81.               FTP.PSS ~
  82.               MAIL-NIFTP.JANET ~
  83.               MAIL-NIFTP.PSS ~
  84.               MAIL-X29.JANET ~
  85.               MAIL-X29.PSS ~
  86.               MAIL-TELEX.TELEX ~
  87.               JTMP.JANET ~
  88.               JTMP.PSS ~
  89.               JTMP-FILES.JANET ~
  90.               JTMP-FILES.PSS ~
  91.               JTMP-REG.JANET ~
  92.               JTMP-REG.PSS ~
  93.               YBTS.JANET ~
  94.               YBTS.PSS ~
  95.               YBTS-NODE.JANET ~
  96.               YBTS-NODE.PSS
  97.  
  98. /* no options --> do everything en route */
  99.  
  100. &s noargs := [null %compile%%link%%install%%getfiles%%convert%%generate%%build%]
  101.  
  102. /* shorthand */
  103.  
  104. &if ^ [null %build%] &then &do
  105.     &s compile := -
  106.     &s link    := -
  107.     &s install := -
  108. &end
  109.  
  110. /* decode general switches */
  111.  
  112. &if   [null %debug%] ~
  113. &then &s suff :=
  114. &else &s suff := .DBG
  115.  
  116. &if   [null %nocomo%] ~
  117. &then como %name%.BUILD.COMO
  118.  
  119. /* are any binaries out of date? -- if so, recompile */
  120.  
  121. &if %noargs% &then &do
  122.  
  123.     /* Set up %latest% to be the runanable binary to compare */
  124.     /* datestamps with, in case there is no bin file         */
  125.     /* Use local in preference to installed version          */
  126.     &if [exists %bin%%name%.run] ~
  127.     &then &s latest := %bin%%name%.run
  128.     &else &if [exists %instdir%%name%.run] ~
  129.     &then &s latest := %instdir%%name%.run
  130.     &else &s latest :=
  131.  
  132.     &if ^ [exists %include%nrs.h] &then &do
  133.  
  134.         type %include%nrs.h does not exit.
  135.         type please do something about this
  136.  
  137.        como -e -tty
  138.        &return
  139.     &end
  140.  
  141.     &do module &list %defmodules%
  142.  
  143.         &if ^ [exists %source%%module%.cc] &then &do
  144.  
  145.             type %source%%module%.cc does not exit.
  146.             type please do something about this
  147.  
  148.             como -e -tty
  149.             &return
  150.         &end
  151.  
  152.         &if ^ [exists %bin%%module%%suff%.bin] ~
  153.         &then &if [null %latest%] ~
  154.               &then &s addthis := 1
  155.               &else &if [attrib %source%%module%.cc -dtm] ~
  156.                      >  [attrib %latest%            -dtm] ~
  157.                     |   [attrib %include%nrs.h      -dtm] ~
  158.                      >  [attrib %latest%            -dtm] ~
  159.               &then &s addthis := 2
  160.               &else &s addthis :=
  161.         &else &if [attrib %source%%module%.cc     -dtm] ~
  162.                >  [attrib %bin%%module%%suff%.bin -dtm] ~
  163.               |   [attrib %include%nrs.h          -dtm] ~
  164.                >  [attrib %latest%                -dtm] ~
  165.         &then &s addthis := 3
  166.         &else &s addthis :=
  167.  
  168.         &if ^ [null %addthis%] ~
  169.         &then &do
  170.             &s compile := -
  171.             type %module% by %addthis%
  172.             &if   [exists %bin%%module%%suff%.bin] ~
  173.             &then &if   [null %comfile%] ~
  174.                   &then &s comfile := %module%
  175.                   &else &s comfile := %comfile% %module%
  176.  
  177.         &end
  178.     &end
  179.  
  180.     /* OK -- if ANY binary need compiling, also compile missing ones */
  181.     &if ^ [null %compile%] &then ~
  182.     &do module &list %defmodules%
  183.         &if   ^ [exists %bin%%module%%suff%.bin] ~
  184.               &then &s comfile := %comfile% %module%
  185.     &end
  186.  
  187. &end
  188.  
  189. &if ^ [null %compile%] &then &do
  190.     &if   [null %comfile%] ~
  191.     &then &s modules := %defmodules%
  192.     &else &s modules := %comfile%
  193.  
  194.     type Compiling %modules% for version %version% of %name%...
  195.  
  196.     &do module &list %modules%
  197.         &if   ^ [null %report%] ~
  198.         &then type Compiling %module%
  199.         cc %source%%module% %cflags% -b %bin%%module%%suff%.bin
  200.     &end
  201. &end
  202.  
  203.  
  204. /* is the .run out of date? -- if so, relink */
  205.  
  206. &if %noargs% &then &do
  207.     &if   [null %latest%] ~
  208.     &then &s link := -
  209.     &else &do module &list %defmodules%
  210.         &if [exists %bin%%module%%suff%.bin] ~
  211.         &then &if [attrib %bin%%module%%suff%.bin -dtm] ~
  212.                >  [attrib %latest%                -dtm]~
  213.         &then &s link := -
  214.     &end
  215. &end
  216.  
  217. &if ^ [null %link%] &then &do
  218.  
  219.     type Linking version %version% of %bin%%name%...
  220.  
  221.     &data bind %bin%%name%
  222.         version [quote %name% rev %version%]
  223.         li ccmain
  224.         &do module &list %defmodules%
  225.             lo %bin%%module%%suff%
  226.         &end
  227.         li c_lib
  228.         li
  229.         ma -un
  230.         file
  231.     &end
  232. &end
  233.  
  234. /* deal with installation -- do not overwrite by default! */
  235.  
  236. &if %noargs% &then &do
  237.     &if   ^ [exists %instdir%%name%.run] ~
  238.     &then &s install := -
  239.     &else &if [exists %bin%%name%.run] ~
  240.     &then &if [attrib %bin%%name%.run     -dtm] ~
  241.            >  [attrib %instdir%%name%.run -dtm] ~
  242.     &then &do
  243.  
  244.         type The installed version of %name% is out of date.
  245.         type To install the new copy type the command: r make -install
  246.         type To make a new t.central anyway type     : r make -generate
  247.  
  248.         como -e -tty
  249.         &return
  250.     &end
  251. &end
  252.  
  253. &if   ^ [null %install%] ~
  254. &then copy %bin%%name%.run %instdir%== -dl -nq -nvfy -rpt
  255.  
  256. &if   [null %nocomo%] ~
  257. &then como -e
  258.  
  259. /* is the DERFIL2.RAW available? -- if not, fetch it */
  260.  
  261. &if %noargs% &then &do
  262.     &if ^ [exists %rawderfil%] ~
  263.     &then &s getfiles := -
  264. &end
  265.  
  266. /* fetch the file from salford */
  267.  
  268. &if   ^ [null %getfiles%] &then &do
  269.  
  270.    &select TRUE
  271.  
  272.       &when %nift%
  273.          nift %nrsdir%DERFIL2 ~
  274.               %rawderfil% -fr %nrsaddr% -ru %nrsuser% %nrspw% -t -lp %localpw%
  275.  
  276.       &when %serc%
  277.          &data FTP
  278.             SITE %nrsaddr%
  279.             RTREE %nrsdir%
  280.             LTREE %rawderfil%
  281.             REMOTE %nrsuser% %nrspw%
  282.             LOCAL %localuser% %localpw%
  283.             FETCH DERFIL2 (NOBIN)
  284.             QUIT
  285.          &end
  286.  
  287.       &when %isocept%
  288.          &data ISOCEPT
  289.             FTP
  290.             %nrsdir%DERFIL2 AT %nrsaddr% TO %rawderfil% AT %thissite%
  291.             %nrsuser%
  292.             %nrspw%
  293.             TEXT
  294.             YES
  295.             I-HAVE-NO-REFERENCE
  296.             &end
  297.       &end
  298.  
  299.    &if %noargs% &then~
  300.       &stop 1 &message ~
  301.               You must wait for the file to be transfered before converting it
  302.  
  303. &end
  304.  
  305. /* is the DERFIL2 out of date? -- if so, convert */
  306.  
  307. &if %noargs% &then &do
  308.     &if [attrib %rawderfil% -dtm] > [attrib %derfil% -dtm]~
  309.     &then &s convert := -
  310. &end
  311.  
  312. /* convert the file to a useable format */
  313.  
  314. &if   ^ [null %convert%] ~
  315. &then %decompress% %rawderfil% %derfil%
  316.  
  317. &if %noargs% &then &do
  318.  
  319.     &if ^ [exists %derfil%] &then &do
  320.         type %derfil% can't be found.
  321.         type Please do something about it
  322.  
  323.         como -e -tty
  324.         &return
  325.     &end
  326.  
  327.     &if ^ [exists %central%] ~
  328.     &then &s generate := -
  329.     &else &if [attrib %derfil% -dtm] > [attrib %central% -dtm]~
  330.     &then &s generate := -
  331.     &else type %central% is up to date
  332. &end
  333.  
  334. &if ^ [null %generate%] &then &do
  335.  
  336.    type making %central%
  337.  
  338.    como %central%.tmp -ntty
  339.  
  340.    type .nf
  341.    type .H1 Forward Lookup
  342.    type
  343.  
  344.    &do netname &list %network%
  345.        &s net := [before %netname% '.']
  346.        &s subnet := [after %netname% '.']
  347.        type .H1 Context %net% Subnetwork %subnet%
  348.        type
  349.        r %instdir%%name% %config% [quote context %net% %subnet%]
  350.    &end
  351.  
  352.    type
  353.    type .H1 Reverse lookup
  354.    type
  355.  
  356.    &do netname &list %network%
  357.        &s net := [before %netname% .]
  358.        &s subnet := [after %netname% .]
  359.        type .H1 Context %net% Subnetwork %subnet%
  360.        type
  361.        r %instdir%%name% %config% [quote context %net% %subnet%] 'output reverse text'
  362.    &end
  363.  
  364.    como -e -tty
  365.  
  366.    cname %central%.tmp %central%
  367.  
  368. &end
  369.  
  370. como -e -tty
  371. &return
  372.